
package com.hlkj.pay.service.merchant;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.framework.common.pojo.PageResult;
import com.hlkj.pay.dto.merchant.MerchantAppChannelListDto;
import com.hlkj.pay.dto.merchant.MerchantAppQueryDto;
import com.hlkj.pay.enums.MerchantEnum;
import com.hlkj.pay.infrastructure.model.merchant.MerchantAppChannelDO;
import com.hlkj.pay.infrastructure.model.merchant.MerchantAppDO;

import java.util.List;

/**
 * @author HlpayTeam
 * @date 2024/09/12 13:40
 */
public interface IMerchantApplicationService {

    /**
     * query page
     * 
     * @param merchantInfoQueryDO
     * @return
     */

    PageResult<MerchantAppDO> queryPage(MerchantAppQueryDto merchantInfoQueryDO);
    /**
     * query page
     *
     * @param merchantInfoQueryDO
     * @return
     */

    List<MerchantAppDO> queryList(MerchantAppQueryDto merchantInfoQueryDO);

    /**
     * query detail
     * 
     * @param id
     * @return
     */
    MerchantAppDO queryDetail(Long id);
    /**
     * query detail
     *
     * @param merchantAppDO
     * @return
     */
    void addApp(MerchantAppDO merchantAppDO);
    /**
     * query default app
     *
     * @param sn
     * @return
     */
    MerchantAppDO queryDefaultApp(String sn);
    /**
     * query detail
     * 
     * @param appId
     * @return
     */
    MerchantAppDO queryDetailByAppId(String appId);

    MerchantAppDO getByAppId(String appId);

    /**
     * update
     * 
     * @param updateMerchantAppDO
     */
    void saveMerchantApp(MerchantAppDO updateMerchantAppDO);

    /**
     * update
     * 
     * @param updateMerchantAppDO
     */
    void updateMerchantApp(MerchantAppDO updateMerchantAppDO,String appId);

    /**
     *
     * @param appId
     * @param status
     */
    void updateMerchantAppStatus(String appId, Integer status);
    /**
     *
     * @param appId
     */
    void delMerchantAppByAppId(String appId,Long id);

    /**
     *
     */
    String generateAppId();

    /**
     *
     * @param merchantInfoQueryDO
     * @return
     */
    PageResult<MerchantAppChannelListDto> queryChannelPage(MerchantAppQueryDto merchantInfoQueryDO);
    /**
     * query sub channel
     *
     * @param merchantAppQueryDto
     */
    List<MerchantAppChannelDO> queryChannelInfoList(MerchantAppQueryDto merchantAppQueryDto);
    /**
     * query sub channel
     *
     * @param merchantAppQueryDto
     */
    List<MerchantAppChannelDO> queryEffectProvideAppId(MerchantAppQueryDto merchantAppQueryDto);
    /**
     * query sub channel
     *
     * @param sn
     * @param appId
     * @param providerCode
     * @param channelCode
     */
    List<MerchantAppChannelDO> queryChannelInfoList(String sn, String appId,String providerCode, String channelCode,Integer status, Integer routerStrategy);

    /**
     *
     * @param id
     * @return
     */
    MerchantAppChannelDO queryAppChannelDetail(String code);

    /**
     *
     * @param id
     * @return
     */
    MerchantAppChannelDO queryAppChannelDetailBySubMchId(String subMchId);

    /**
     * save app channel
     * 
     * @param merchantAppChannelDO
     */
    void saveMerchantAppChannel(MerchantAppChannelDO merchantAppChannelDO);
    void saveBatchMerchantAppChannel(List<MerchantAppChannelDO> merchantAppChannelList);

    /**
     * update app channel
     * 
     * @param updateMerchantAppDO
     */
    void updateMerchantAppChannel(MerchantAppChannelDO updateMerchantAppDO,String code);

    /**
     * del app channel
     * 
     * @param code
     * @param sn
     * @param appId
     */
    void delMerchantAppChannel(String code,String sn,String appId);

    /**
     * update app channel status
     * 
     * @param code
     * @param status
     * @param sn
     * @param appId
     */
    void updateMerchantAppChannelStatus(String code, Integer status,String sn,String appId);

    void updateMerchantAppChanneLimitRouter(String code, Integer limitRouter);
    /**
     *
     * @param sn
     */
    void delMerchantAppBySn(String sn);

    /**
     *
     * @param merchantAppChannelDO
     * @param channelParams
     */
    void updateAppConfig(MerchantAppChannelDO merchantAppChannelDO, String channelParams);

    /**
     *
     * @param id 关联id
     * @param accessType 1 进件 2 报备
     * @return
     */
    MerchantAppChannelDO queryDetailByAccessId(Long id, MerchantEnum.DATA_RELATION_TYPE accessType);

    /**
     *
     * @param id
     * @return
     */
    MerchantAppChannelDO queryDetailByAccessId(String appId, Long id);

    /**
     * 生成收银台链接
     * @param id appid
     * @return
     */
    CommonResult<String> cashierUrl(Long id);
}
